home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / Syn Text Editor 2.1.0.46 / synsetup-2.1.0.46.exe / {app} / templates / Pascal / Pascal Console.pas < prev    next >
Pascal/Delphi Source File  |  2003-08-13  |  1KB  |  52 lines

  1. {Description: Pascal Commandline Program|}
  2. {
  3.   Created: {$DateTime} by {$UserName}
  4.  
  5.   $Id: Pascal\040Console.pas,v 1.1.2.3 2003/08/13 00:38:45 neum Exp $
  6. }
  7.  
  8. program {$FileTitleNoExt};
  9. {$APPTYPE CONSOLE}
  10.  
  11. procedure ShowHelp;
  12. begin
  13.   { To Do: add your usage message here }
  14.   WriteLn('Usage: {$FileTitleNoExt} [options] [files] etc.');
  15.   Halt(0);
  16. end;
  17.  
  18. procedure HandleOptions;
  19. var
  20.   i: integer;
  21.   switch: string;
  22. begin
  23.   { To Do: process Arguments }
  24.   if ParamCount > 0 then begin
  25.     i := 1;
  26.     while i <= ParamCount do begin
  27.       switch := ParamStr(i);
  28.       if (switch[1] = '/') or (switch[1] = '-') then begin
  29.         Delete(switch, 1, 1);
  30.         if (switch = '?') or (switch = 'help') then
  31.           { Help is requested }
  32.           ShowHelp
  33.           
  34.         { To Do: Add your option switches here }
  35.         else begin
  36.           WriteLn('Unknown Option "' + switch + '"');
  37.           Halt(1);
  38.         end;
  39.       end else begin
  40.         {...}
  41.       end;
  42.       Inc(i);
  43.     end;
  44.   end else
  45.     ShowHelp;
  46. end;
  47.  
  48. begin
  49.   HandleOptions;
  50.   { To Do: Enter usercode here }
  51. end.
  52.